home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 46 / Mobiclic46.iso / pc / DATA / LANGUES / doggy2002.cst / 00392_Script_évolutions sur menus.cst < prev   
Text File  |  2002-08-06  |  3KB  |  101 lines

  1. global traitLiaison
  2.  
  3. on initMobile sPoint,remplacement
  4.   -- initialisation d'une procΘdure traitLaison
  5.   -- sPoint est le numΘro de la piste portant le point mobile (ex: acteur TrL Point de menu.cst)
  6.   -- remplacement : si 0 l'acteur de la piste sPoint est utilisΘ, 1 il est remplacΘ par l'acteur
  7.   -- de la piste s
  8.   
  9.   cursor 290
  10.   s = the currentSpriteNum
  11.   x = the mouseH - the locH of sprite s
  12.   y = the mouseV - the locV of sprite s
  13.   if the paramCount =1 then
  14.     remplacement=0
  15.   end if
  16.   sound(2).play(member "poc")
  17.   sprite(sPoint).locH = the mouseH -x
  18.   sprite(sPoint).locV = the mouseV - y
  19.   if remplacement = 1 then
  20.     sprite(sPoint).member = sprite(s).member
  21.   end if
  22.   afficherPistes sPoint
  23.   traitLiaison = [s,x,y]
  24.   updateStage
  25. end
  26.  
  27. on gestMobile pisteMobile
  28.   -- pisteMobile : piste du point mobile
  29.   -- la variable liste traitLiaison contient :
  30.   ---- 1 : piste de l'objet origine
  31.   ---- 2 : locH de l'objet origine
  32.   ---- 3 : locV de l'objet origine
  33.   
  34.   sprite(pisteMobile).locH = the mouseH - traitLiaison[2]
  35.   sprite(pisteMobile).locV = the mouseV - traitLiaison[3]
  36.   updateStage
  37. end
  38.  
  39. on glisserDeposer s1,s2,s3,s4,mode
  40.   -- s1 : est la piste cible de plus bas numΘro
  41.   -- s2 : est la piste cible de numΘro le plus ΘlevΘ
  42.   -- s3 : piste acteur α dΘplacer de plus bas numΘro
  43.   -- s4 : piste point en bout d'Θlastique
  44.   -- mode : l'objet dΘplacΘ est supprimΘ si valeur 1, laissΘ en place si 0
  45.   if the paramCount =3 then
  46.     mode = 0
  47.   end if
  48.   global traitLiaison, choix
  49.   if sprite(s4).visible = 1 then
  50.     cursor -1
  51.     s = traitLiaison[1]
  52.     repeat with i = s1 to s2
  53.       if sprite(s4).intersects(i) then
  54.         -- emplacement occupΘ ? ------------------------------------
  55.         if choix[i+1-s1]<>0 then
  56.           if mode = 1 then
  57.             afficherPistes s3-1+choix[i-s1+1]
  58.           end if
  59.         end if
  60.         -- mise en place de l'ΘlΘment glissΘ -----------------------
  61.         sprite(i).member = sprite(s4).member
  62.         updateStage
  63.         choix[i-s1+1] = s-s3+1
  64.         afficherPistes i
  65.         if mode = 1 then
  66.           masquerPistes s
  67.         end if
  68.         updateStage
  69.         sound(2).play(member "poc")
  70.         exit repeat
  71.       end if
  72.     end repeat
  73.     masquerPistes s4-2,s4-1,s4
  74.     -- l'ΘlΘment dΘposΘ n'est en intersection avec aucune zone
  75.     if i=1+s2 then
  76.       sound(2).play(member "echec")
  77.     end if
  78.   end if
  79. end
  80.  
  81. -- partie entiΦre d'un nombre
  82. on entiere nombre
  83.   chaine = string(nombre)
  84.   posVirgule = offset(".", chaine)
  85.   if posVirgule = 0 then
  86.     return nombre
  87.   else
  88.     return value(chaine.char[1..posVirgule])
  89.   end if
  90. end
  91.  
  92. -- partie fractionnaire d'un nombre
  93. on fraction nombre
  94.   chaine = string(nombre)
  95.   posVirgule = offset(".", chaine)
  96.   if posVirgule = 0 then
  97.     return 0
  98.   else
  99.     return value(chaine.char[posVirgule..chaine.char.count])
  100.   end if
  101. end